home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / utility / 601 / mc_sprit / sprite.asc < prev    next >
Encoding:
Text File  |  1992-05-16  |  3.7 KB  |  108 lines

  1. The enclosed files include an assy. routine for merging with 
  2. GFA so that you can produce multi-colored sprites of any size
  3. quickly and efficiently.  Files that should be included in this
  4. arc file are:
  5.  
  6.      F_SPRITE.INL        The assy. program to handle the sprite
  7.                          conversions.
  8.  
  9.      SPT_SHOW.PRG        A simple sample of F_SPRITEL.INL in use.
  10.  
  11.      SPRITE.ASC          This text file.
  12.  
  13. These files are offered for public use.  I reserve only my own
  14. personal right to use and modify the routine as I see fit.
  15.  
  16.                                 Mike Harrington
  17.                                 R.HARRINGTO1
  18.                                 5/16/92
  19.  
  20.  
  21. USING THE ROUTINE:
  22.  
  23. Step 1.
  24.       Create the following GFA statement within your code:
  25.  
  26.                     INLINE tsprite%,300
  27.       
  28.       Locate the cursor on the above line, then press the "HELP"
  29. key.  Select "LOAD" from the presented options menu.  When the 
  30. file selector box is displayed, select "F_SPRITE.INL" to load the
  31. assy. routine into your GFA file.  The assy. routine will be 
  32. saved along with your code.  NOTE:  (When you save the program,
  33. be sure to correct your file name, otherwise "F_SPRITE.GFA" will
  34. be the default name.
  35.  
  36.  
  37. Step 2.
  38.       Dimmension an array of 16 integers to hold the current
  39. register data.  Example:
  40.  
  41.            DIM  tspt%(16)  
  42.  
  43.  
  44. Step 3.
  45.       Create the following GFA function:
  46.  
  47.           FUNCTION Build$
  48.             Local newspt$
  49.             newspt$=tempbkgd$
  50.             tspt%(1)=VARPTR(newspt$)+6
  51.             tspt%(0)=VARPTR(ctpart$)+6
  52.             tspt%(2)=tspt%(0)+LEN(newspt$)-6
  53.             RCALL tsprite%,tspt%()
  54.             RETURN newspt$
  55.           END FUNCTION
  56.  
  57.       
  58.      Ctpart$ holds a copy of the current sprite as captured by
  59. the GFA GET x%,y%,ctpart$ command.  Tempbkgd$ holds a copy of the
  60. current background that is to be merged with the sprite.  This 
  61. also is a capture of the GFA GET x%,y%,tempbkgd$ command.
  62. Tempbkgd$ is transfered to newspt$ so that the real background
  63. is not modified.  Then the work begins.
  64.      The memory location of newspt$ and ctpart$ are assigned to
  65. tspt%(1) and tspt%(0), respectively.  Notice that each location
  66. is adjusted by -6 or 3 words.  GFA uses these first 3 words to
  67. identify the sprite size and the screen rez., so they must not be
  68. modified.  The length of the sprite is stored in tspt%(2).
  69. Notice that we include the 3 words used by GFA in this statement
  70. so that we get the full length of the sprite.  
  71.      After the assy. routine has merged the two sprites, newspt$
  72. is passed back to the calling program for use as desired.  This 
  73. is still a standard GFA graphic, so any of the normal modes may
  74. used.
  75.  
  76.  
  77. Step 4.
  78.       To call the Build$ function, use the following perimeters:
  79.    a)  place your sprite (ctpart$) on a black background.
  80.    b)  use the GET x,y,ctpart$ command to capture the sprite.
  81.    c)  use the GET x,y,tempbkgd$ command to capture the back-
  82.        ground that you wish to merge with the current sprite.
  83.        (NOTE:::
  84.             ctpart$ and tempbkgd$ must be of identical size...
  85.             --------------------------------------------------
  86.        The actual size itself is unimportant.
  87.    d)  call the build$ function as follows:
  88.        mysprite$=FN build$
  89.    e)  Use the PUT x%,y%,mysprite$ command to place the modified
  90.        sprite.
  91.  
  92.  
  93.  
  94.  
  95. ABOUT THE SAMPLE PROGRAM:
  96.      SPT_SHOW.PRG is a simple illustration of the above sprite
  97. generator.  A simple multi-colored screen is drawn, then a simple
  98. sprite will move across the screen.  The speed will gradually 
  99. increase to the point that the sprite almost become invisible.
  100.  
  101.  
  102.                                    Best wishes
  103.                                    Mike Harrington
  104.     
  105.  
  106.  
  107.  
  108.